<table width="99%" border="0" cellpadding="0" cellspacing="0" class="frame_right">
  <tr>
    <td width="328" class="call"><strong><?php echo Kohana::lang('site_lang.lbl_call_us')?>: +848 39105055</strong><br />
      <?php echo Kohana::lang('site_lang.lbl_between')?> (8:30am - 6:00pm)</td>
  </tr>
  <tr>
    <td class="dangky"><?php echo Kohana::lang('site_lang.lbl_register_online')?></td>
  </tr>
  <tr>
    <td>
	<?php
$mEventList = $this->get_events();
if($this->uri->segment(2)=='event'){
$prm = $this->uri->argument(1);
$chm = $this->uri->argument(2);
}
$month=date("m",time());
$year = date("Y",time());
$adj='';
if(isset($prm)){
$m=$prm+$chm;
}else{
$m= date("m");
}
$d= date("d");     // Finds today's date
$y= date("Y");     // Finds today's year
$no_of_days = date('t',mktime(0,0,0,$m,1,$y)); // This is to calculate number of days in a month
$mn=date('m',mktime(0,0,0,$m,1,$y)); // Month is calculated to display at the top of the calendar
$yn=date('Y',mktime(0,0,0,$m,1,$y)); // Year is calculated to display at the top of the calendar
$j= date('w',mktime(0,0,0,$m,1,$y)); // This will calculate the week day of the first day of the month


if($mn==01) $mlang= Kohana::lang('site_lang.lbl_01');
else if ($mn==02) $mlang= Kohana::lang('site_lang.lbl_02');
else if ($mn==03) $mlang= Kohana::lang('site_lang.lbl_03');
else if ($mn==04) $mlang= Kohana::lang('site_lang.lbl_04');
else if ($mn==05) $mlang= Kohana::lang('site_lang.lbl_05');
else if ($mn==06) $mlang= Kohana::lang('site_lang.lbl_06');
else if ($mn==07) $mlang= Kohana::lang('site_lang.lbl_07');
else if ($mn==08) $mlang= Kohana::lang('site_lang.lbl_08');
else if ($mn==09) $mlang= Kohana::lang('site_lang.lbl_09');
else if ($mn==10) $mlang= Kohana::lang('site_lang.lbl_10');
else if ($mn==11) $mlang= Kohana::lang('site_lang.lbl_11');
else  $mlang= Kohana::lang('site_lang.lbl_12');

for($k=1; $k<=$j; $k++){ // Adjustment of date starting
$adj .="<td>&nbsp;</td>";
}
?>
<table bordercolor='#FFFF00' cellspacing='0' cellpadding='0'  class="event" width="100%"  style="height:230px" >

	<tr><td class="title"><?php echo Kohana::lang('site_lang.lbl_event_calendar')?></td></tr>
	<tr><td style="padding:0px 0px 0px 10px" align="center">
		<table width="70%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
			<td width="14%"><a href='<?php echo $this->site['base_url']?>home/event/<?php echo $m?>/-1'><img src="<?php echo $this->site['theme_url']?>index/pics/calendal_back.jpg"/></a></td>
			<td width="40%"><input name="" type="text" value="<?php echo $mn;?>" readonly="true" size="8"  style="text-align:center"/></td>
			<td width="28%"><input name="" type="text"  readonly="true" style="text-align:center" value="<?php echo $yn;?>" size="6"/></td>
			<td width="18%" style="padding-left:5px"><a href='<?php echo $this->site['base_url']?>home/event/<?php echo $m?>/1'><img src="<?php echo $this->site['theme_url']?>index/pics/calendal_next.jpg" /></a></td>
		  </tr>
		</table>
 	</td>
	</tr>
	<tr><td>
		<table cellspacing='0' cellpadding='0'  width='85%' border='0' align="center"  class="calendar">
			<tr>
			<td><?php echo Kohana::lang('site_lang.lbl_sun')?></td>
			<td><?php echo Kohana::lang('site_lang.lbl_mon')?></td>
			<td><?php echo Kohana::lang('site_lang.lbl_tue')?></td>
			<td><?php echo Kohana::lang('site_lang.lbl_wed')?></td>
			<td><?php echo Kohana::lang('site_lang.lbl_thu')?></td>
			<td><?php echo Kohana::lang('site_lang.lbl_fri')?></td>
			<td><?php echo Kohana::lang('site_lang.lbl_sat')?></td>
			</tr><tr>

<?php
//////// Starting of the days//////////
for($i=1;$i<=$no_of_days;$i++){
$link='';
$class='';
$Tip='';
$link='<div class="calendar">'.$i.'</div>';
if($d==$i && $m==$month && $y==$year){
$link='<div class="today">'.$i.'</div>';
}	
foreach($mEventList as $event){
	$time = mktime(0,0,0,$m,$i,$y);
	$timeEvent = mktime(0,0,0,date('m',$event['programs_begin_date']),date('d',$event['programs_begin_date']),date('Y',$event['programs_begin_date']));
	$timeEventEnd = mktime(0,0,0,date('m',$event['programs_end_date']),date('d',$event['programs_end_date']),date('Y',$event['programs_end_date']));
	if($timeEvent <= $time && $time <= $timeEventEnd){ 
	$link='<div class="event"><a  href="'.$this->site['base_url'].'library/programs/'.$event['programs_id'].'" title="'.$event['programs_title'].'">'.$i.'</a></div>';
	$Tip='<span id="event_'.$i.'" style="display:none;text-align:justify;">'.$event['programs_title'].'</span>';
	}
}

	
echo $adj."<td >$link</td>";
$adj='';
$j ++;
if($j==7){echo "</tr><tr>";
$j=0;}
echo $Tip;
}
?>
</tr></table></td></tr></table>
	</td>
  </tr>
  <tr>
    <td  class="space_line"></td>
  </tr>
  <tr>
    <td>
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="item_boder">
      <tr>
        <td class="item_boder_title" ><?php echo Kohana::lang('site_lang.lbl_forum')?></td>
      </tr>
      <tr>
        <td class="item_boder_content"><ul>
          <li><span>Attitude Change</span><br />
            Create a change in perception and encourage positive thinking. <span class="chitiet">chi tiết...</span></li>
          <li><span>Attitude Change</span><br/>
            Create a change in perception and encourage positive thinking. <span class="chitiet">chi tiết...</span></li>
          </ul></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><img src="<?php echo $this->site['theme_url']?>index/pics/img_newsletter.jpg" width="335" height="115" /></td>
  </tr>
  <tr>
    <td  class="space_line"></td>
  </tr>
  <tr>
    <td><table class="item_client" width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td class="item_title" ><?php echo Kohana::lang('site_lang.lbl_clients_say')?>?</td>
      </tr>
      <tr>
        <td class="item_content"><ul>
		<?php 
		$mTestimonials = $this->get_testimonial();
		foreach($mTestimonials as $list) {?>
          <li><span><?php echo $list['testimonials_title'];?></span><br />
           <?php echo $list['testimonials_description'];?>
		   <span class="chitiet"><a href="<?php echo $this->site['base_url']?>clients/testimonials/<?php echo $list['testimonials_id']?>"><?php echo Kohana::lang('site_lang.lbl_more') ?></a></span></li>
			<?php }?>
           </ul></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td  class="space_line"></td>
  </tr>
  <tr>
    <td ><img src="<?php echo $this->site['theme_url']?>index/pics/img_quatang.jpg" width="340" height="152" /></td>
  </tr>
  <tr>
    <td  class="space_line"></td>
  </tr>
  <tr>
    <td>
	<a href="http://www.dalecarnegie.com" target="_blank">
	<img src="<?php echo $this->site['theme_url']?>index/pics/img_2.jpg" width="335" height="140" />
	</a>
	</td>
  </tr>
  <tr>
    <td  class="space_line"></td>
  </tr>
  <tr>
    <td align="center" class="copy">
	<a href="<?php echo $this->site['base_url']?>pages/detail/2">
	<img src="<?php echo $this->site['theme_url']?>index/pics/img_copy.jpg" width="329" height="43" />
	</a>
	</td>
  </tr>
</table>